using UnityEngine;

public class PlayerState_翻滚 : PlayerStateBase
{
	private float _EnterDrag;

	private float _完美闪避触发时间 = 0.175f;

	private float _完美闪避触发时间timer;

	public PlayerState_翻滚()
	{
		_Data_Player招式_系数 = MonoSingleton<MyDataManager>.Instance._Data_玩家招式._闪避;
	}

	public override void OnEnter()
	{
		_EnterDrag = _Mono._Rb2D.drag;
		_Mono._Rb2D.drag = 0f;
		_Mono._Rb2D.velocity = Vector2.zero;
		_Mono._Ani.Play("翻滚");
		if (_Mono._Dir == Vector2.zero)
		{
			_Mono._Rb2D.velocity = new Vector2((_Mono._朝向右边 ? 1 : (-1)) * 13, 0f);
		}
		else
		{
			_Mono._Rb2D.velocity = _Mono._Dir * 13f;
		}
		_Mono._触发完美闪避 = true;
		_Mono._可以受击 = false;
		_完美闪避触发时间timer = _完美闪避触发时间;
		MonoSingleton<AudioManager>.Instance.F_Play_SFX(_Mono._AudioC_跳跃);
		_Timer = 0.315f;
		_NextState = StateType_Player.正常移动;
		_Mono._Curr气力 -= _Data_Player招式_系数._气力消耗;
		Physics2D.IgnoreLayerCollision(6, 3, ignore: true);
	}

	public override void OnExit()
	{
		Physics2D.IgnoreLayerCollision(6, 3, ignore: false);
		_Mono._Rb2D.drag = _EnterDrag;
		_Mono._触发完美闪避 = false;
		_Mono._可以受击 = true;
	}

	public override void OnUpdate()
	{
		base.OnUpdate();
		_完美闪避触发时间timer -= Time.deltaTime;
		if (_完美闪避触发时间timer <= 0f && _Mono._触发完美闪避)
		{
			_Mono._触发完美闪避 = false;
		}
	}
}
